import { createRouter, createWebHashHistory } from "vue-router";
import Home from '@/views/Home.vue';

const routes = [
  {
    name: 'home',
    path: '/',
    meta: {
      title: '首页'
    },
    component: Home,
    redirect: '/demo',
    children: [
      {
        name: 'demo',
        path: '/demo',
        component: () => import('@/views/Demo/index.vue'),
        meta: {
          title: '示例演示'
        },
        redirect: '/demo:1-1',
        children: [
          {
            name: 'sample',
            path: '/demo:id',
            // component: () => import('@/views/Demo/components/sample-codemirror.vue'), // vue-codemirror
            component: () => import('@/views/Demo/components/sample-monaco.vue'), // monaco-editor
            meta: {
              keepAlive: true
            },
          },
        ]
      },
    ]
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes
});
export default router